package m.jclecai.com.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import m.jclecai.com.R;
import m.jclecai.com.adapter.holder.RmfamousItemHolder;
import m.jclecai.com.bean.reconmend.ReconmentRecord;
import m.jclecai.com.listener.Callback;

/**
 * Created by ZD on 2017/7/19.
 */

public class RmfamousItemAdapter extends RecyclerView.Adapter<RmfamousItemHolder> {

    private Context mContext;
    private Callback mCallback;
    private List mList;
    private int mFlag;

    public RmfamousItemAdapter(Context mContext,List mList,int mFlag) {
        this.mContext = mContext;
        this.mList = mList;
        this.mFlag = mFlag;
    }

    @Override
    public RmfamousItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new RmfamousItemHolder(View.inflate(mContext, R.layout.item_rm_famous,null));
    }

    @Override
    public void onBindViewHolder(RmfamousItemHolder holder, int position) {
        ReconmentRecord record = (ReconmentRecord) mList.get(position);
        holder.init(mCallback ,record);
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public void setmCallback(Callback mCallback) {
        this.mCallback = mCallback;
    }
}
